package check.md5;

import java.security.MessageDigest;
import java.util.zip.Checksum;

public class MessageDigestAdapter implements Checksum {
	protected MessageDigest messageDigest;

	public MessageDigestAdapter(MessageDigest messageDigest) {
		this.messageDigest = messageDigest;
	}

	@Deprecated
	public final long getValue() {
		// MessageDigest checksum is longer than long
		return 0;
	}

	@Override
	public final void reset() {
		messageDigest.reset();
	}

	@Override
	public final void update(int b) {
		messageDigest.update((byte) b);
	}

	@Override
	public final void update(byte[] b, int off, int len) {
		messageDigest.update(b, off, len);
	}

}
